<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<script src="/js/jquery.min.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/bootstrap.css" />
	<script src="/js/bootstrap.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/admincss.css" />
	<!-- <script src="/js/admin/adminPublic.js"></script> -->
	<title>@yield('title')</title>
	<style type="text/css">
		html,body{
			font-family: "微软雅黑";
		}
	</style>
</head>
<body>
	
	<!-- header part -->
	<div class="header">
		<div class="headerLeft">鹤庭净水后台数据管理平台</div>
		<div class="headerRight">
			<div>
				<span>欢迎您：</span>
                <span class="AccountName">{{ $user->username }}</span>
			</div>
			<div class="btn modifyPassword">
				<p class="modifyLogo"></p>
				<p >修改密码</p>
			</div>
			<div class="btn bowOut">
				<p class="bowoutLogo"></p>
				<p style="margin-left: 25px;">退出</p>
			</div>
		</div>
	</div>

	<!-- content part -->
	<div class="content">
		<!-- contentLeft part -->
		<div class="contentLeft">
			<div class="logoBox"><img src="/img/admin/logoPic.png" /></div>
			<ul class="menuList">
				<a class="devicelist" href="/admin/device/index">
					<img src="/img/admin/deviceListLogo.png" />设备列表
				</a>
				<a class="reminders" href="/admin/device/reminder/filter">滤芯寿命提醒<span class="filterHintNum">{{ $filter_reminders_count }}</span>
				</a>
				<a class="remindersFlux" href="/admin/device/reminder/flow">剩余流量提醒<span class="fluxHintNum">{{ $flow_reminders_count }}</span>
				</a>
				<a class="customers" href="/admin/user/customers">
					<img src="/img/admin/userInfoLogo.png" />用户信息
				</a>
				<a class="afterservices" href="/admin/user/afterServices">售后服务<span class="notServiceNum">{{ $after_services_count }}</span>
				</a>
				<a class="maintaininfos" href="/admin/device/maintainInfos">维护信息<span class="notMaintaininfosNum">{{ $maintain_info_count }}</span></a>
				<a class="installinfos" href="/admin/device/installInfos">安装信息</a>
				<a class="chargerecords" href="/admin/device/chargeRecords">
					<img src="/img/admin/shopCarLogo.png" />充值管理
				</a>
				<a class="dealerManage" href="/admin/device/chargeRecords/dealer">经销商管理</a>
				<a class="index" href="/admin/user/index">
					<img src="/img/admin/accountManageLogo.png" />账号管理
				</a>
			</ul>
		</div>
		<!-- contentRight part -->
		<div class="contentRight">
			<div class="itemText">
				<span class="spanFirst">当前位置：</span>
               	@section('firstItem')
				    
				@show
			</div>
			<div class="searchList">
				@section('searchList')

                @show
			</div>
			<div class="clearfloat"></div> 
			<!-- table part -->
			@section('dataTables')
			
            @show
            <!-- page number part -->
            <div class="rightFooter">
            	@section('add_div')
			
           		@show
				@section('page_num')
				
				@show
			</div>
            @section('infor_promit')
		</div>
		<div class="clearfloat"></div> 
	</div>
	@show
	<!-- 修改密码弹框 -->
	<div class="accountManageBg updatePassword">
		<div class="accountManage" >
			<p class="titleTxt">修改密码</p>
			<div><span>旧密码</span><input class="oddPassword" type="password" placeholder="请输入旧密码" /></div>
			<div><span>新密码</span><input class="newPassword" type="password" placeholder="请输入新密码" /></div>
			<div><span>确认密码</span><input class="confirmPassword" type="password" placeholder="请再输入新密码" /></div>
			<div>

			</div>
			<label class="labelBox" id="updataPWlabelBox"></label>
			<div class="btnBox" >
				<a class="cancelBtn updataPWCancelBtn">取消</a>
				<a class="okBtn updataPWOkBtn">确定</a>
			</div>
		</div>
	</div>
	<!-- 删除维护信息弹框 -->
	<div class="deleteBox" style="display: none;">
		<p>删除</p>
		<div class="titleText">确定删除此条维护信息？</div>
		<div class="btnBox">
			<a class="cancelBtn">取消</a>
			<a class="okBtn">确定</a>
		</div>
	</div>
	<!-- 退出账号弹框 -->
	<div class="deleteBoxBg bowOutBg">
		<div class="deleteBox deleteIInfos">
			<p>退出账号</p>
			<div class="titleText">确定退出此账号？</div>
			<label class="labelBox" id="bowOutLabelBox"></label>
			<div class="btnBox">
				<a class="cancelBtn bowOutCancelBtn">取消</a>
				<a class="okBtn bowOutOkBtn">确定</a>
			</div>

		</div>
	</div>
	<!-- 提示信息框 -->
	<div class="hint_bg">
		<div class="hint_box">
			<p class="hint_text"></p>
			<div class="hint_btn">确定</div>
		</div>
	</div>
	<script>
	//服务器提示信息
	function hint(hint){
		if(hint)
		{
			$('.hint_bg').css("display","block");
			$('.hint_bg').height($(window).height());
			$('.hint_text').html(hint);
			$('.hint_btn').click(function(){
				$('.hint_bg').css("display","none");
			});
		}
	}
	//计算左边导航栏高度
	if($("table").height()<800){
		$(".contentLeft").height(800+"px");
	}else{
		$(".contentLeft").height($(".contentRight").height());
	}
	// if($("window").width()<1380){
	// 	$(".contentLeft").width(230);
	// 	$(".contentRight").width(1250);
	// 	$(".contentRight table").css({"width":"1150px"});
	// }
	//修改密码
	$(".modifyPassword").click(function(){
		$(".updatePassword").show();
		//$(".updatePassword").height($(window).height());
		$(".updataPWCancelBtn").unbind('click').click(function(){
			$(".updatePassword").hide();
			$(".labelBox").html("");
		})
		$(".updataPWOkBtn").unbind('click').click(function(){
			$.ajax({
				url:"/admin/api/user/updatePassword",
				type:"post",
				dataType:"json",
				data:{
					password:$(".oddPassword").val(),
					new_password:$(".newPassword").val(),
					new_password_confirmation:$(".confirmPassword").val()
				},
				success:function(data){
					if(data.status.errCode==0){

						$("#updataPWlabelBox").html("修改密码成功！");
						setTimeout(function(){
							$(".updatePassword").hide();
						},10000);
						
					}else{
						$("#updataPWlabelBox").html(data.status.message);
					}
				}
			})
		})
	});
	//退出登录
	$(".bowOut").click(function(){

		$(".bowOutBg").show();
		$(".bowOutBg").height($("body").height());

		$(".bowOutCancelBtn").unbind('click').click(function(){
			$(".bowOutBg").hide();
			$(".labelBox").html("");
		})
		$(".bowOutOkBtn").unbind('click').click(function(){
			$.ajax({
				url:"/admin/api/user/logout",
				type:"post",
				dataType:"json",
				success:function(data){
					if (data.status.errCode==0) {
						window.location.href = "/admin/user/login";
					}else{
						$("#bowOutLabelBox").html(data.status.message);
					}
				}
			})
		})
	});
</script>
</body>
</html>
